70 #include "TObjString.h" 84 #include <unordered_map> 105 virtual void algoEndJob ()
override;
108 int statCollectionFromMode(
const char*
tag)
const;
109 void bookDQMHistos(
const char* dqm_dir,
const char* tag);
112 void swapBFieldMode(
void);
115 void algoAnalyzeTheTree();
116 void algoComputeMPVandGain();
119 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange=50,
double HighRange=5400);
120 bool IsGoodLandauFit(
double* FitResults);
122 void qualityMonitor();
123 void MakeCalibrationMap();
124 bool produceTagFilter();
179 std::array< std::vector<APVGain::APVmon>,7 >
Charge_1;
180 std::array< std::vector<APVGain::APVmon>,7 >
Charge_2;
181 std::array< std::vector<APVGain::APVmon>,7 >
Charge_3;
182 std::array< std::vector<APVGain::APVmon>,7 >
Charge_4;
266 unsigned int eventnumber =0;
308 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
315 std::vector<string>::const_iterator it=dqm_tag_.begin();
316 while(it!=dqm_tag_.end()) {
317 if(*it==
std::string(tag))
return it-dqm_tag_.begin();
327 if(A->GetNbinsX() == B->GetNbinsX()){
330 for(
int x=0;
x<=B->GetNbinsX()+1;
x++){
331 for(
int y=0;y<=B->GetNbinsY()+1; y++){
332 A->SetBinContent(
x,y,A->GetBinContent(
x,y)+B->GetBinContent(
x,y));
436 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
437 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
442 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
443 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
458 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " 463 dbe->setCurrentFolder(dqm_dir);
467 if(stag.size()!=0 && stag[0]!=
'_') stag.insert(0,1,
'_');
482 Charge_Vs_Index[elepos] =
dbe->book2S(cvi.c_str() , cvi.c_str() , 88625, 0 , 88624,2000,0,4000);
495 for (
unsigned int i=0;
i<hnames.size();
i++){
505 for (
unsigned int i=0;
i<hnames.size();
i++){
515 for (
unsigned int i=0;
i<hnames.size();
i++){
525 for (
unsigned int i=0;
i<hnames.size();
i++){
540 MPV_Vs_EtaTIB =
dbe->book2DD(
"MPV_vs_EtaTIB" ,
"MPV vs Eta TIB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
541 MPV_Vs_EtaTID =
dbe->book2DD(
"MPV_vs_EtaTID" ,
"MPV vs Eta TID" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
542 MPV_Vs_EtaTOB =
dbe->book2DD(
"MPV_vs_EtaTOB" ,
"MPV vs Eta TOB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
543 MPV_Vs_EtaTEC =
dbe->book2DD(
"MPV_vs_EtaTEC" ,
"MPV vs Eta TEC" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
544 MPV_Vs_EtaTECthin =
dbe->book2DD(
"MPV_vs_EtaTEC1",
"MPV vs Eta TEC-thin" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
545 MPV_Vs_EtaTECthick =
dbe->book2DD(
"MPV_vs_EtaTEC2",
"MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
547 MPV_Vs_PhiTIB =
dbe->book2DD(
"MPV_vs_PhiTIB" ,
"MPV vs Phi TIB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
548 MPV_Vs_PhiTID =
dbe->book2DD(
"MPV_vs_PhiTID" ,
"MPV vs Phi TID" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
549 MPV_Vs_PhiTOB =
dbe->book2DD(
"MPV_vs_PhiTOB" ,
"MPV vs Phi TOB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
550 MPV_Vs_PhiTEC =
dbe->book2DD(
"MPV_vs_PhiTEC" ,
"MPV vs Phi TEC" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
551 MPV_Vs_PhiTECthin =
dbe->book2DD(
"MPV_vs_PhiTEC1",
"MPV vs Phi TEC-thin" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
552 MPV_Vs_PhiTECthick =
dbe->book2DD(
"MPV_vs_PhiTEC2",
"MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
554 NoMPV =
dbe->book2DD(
"NoMPV" ,
"NoMPV" ,350, -350, 350, 240, 0, 120);
556 Gains =
dbe->book1DD(
"Gains" ,
"Gains" , 300, 0, 2);
557 MPVs =
dbe->book1DD(
"MPVs" ,
"MPVs" , MPVbin, MPVmin, MPVmax);
558 MPVs320 =
dbe->book1DD(
"MPV_320" ,
"MPV 320 thickness" , MPVbin, MPVmin, MPVmax);
559 MPVs500 =
dbe->book1DD(
"MPV_500" ,
"MPV 500 thickness" , MPVbin, MPVmin, MPVmax);
560 MPVsTIB =
dbe->book1DD(
"MPV_TIB" ,
"MPV TIB" , MPVbin, MPVmin, MPVmax);
561 MPVsTID =
dbe->book1DD(
"MPV_TID" ,
"MPV TID" , MPVbin, MPVmin, MPVmax);
562 MPVsTIDP =
dbe->book1DD(
"MPV_TIDP" ,
"MPV TIDP" , MPVbin, MPVmin, MPVmax);
563 MPVsTIDM =
dbe->book1DD(
"MPV_TIDM" ,
"MPV TIDM" , MPVbin, MPVmin, MPVmax);
564 MPVsTOB =
dbe->book1DD(
"MPV_TOB" ,
"MPV TOB" , MPVbin, MPVmin, MPVmax);
565 MPVsTEC =
dbe->book1DD(
"MPV_TEC" ,
"MPV TEC" , MPVbin, MPVmin, MPVmax);
566 MPVsTECP =
dbe->book1DD(
"MPV_TECP" ,
"MPV TECP" , MPVbin, MPVmin, MPVmax);
567 MPVsTECM =
dbe->book1DD(
"MPV_TECM" ,
"MPV TECM" , MPVbin, MPVmin, MPVmax);
568 MPVsTECthin =
dbe->book1DD(
"MPV_TEC1" ,
"MPV TEC1" , MPVbin, MPVmin, MPVmax);
569 MPVsTECthick =
dbe->book1DD(
"MPV_TEC2" ,
"MPV TEC2" , MPVbin, MPVmin, MPVmax);
570 MPVsTECP1 =
dbe->book1DD(
"MPV_TECP1" ,
"MPV TECP1" , MPVbin, MPVmin, MPVmax);
571 MPVsTECP2 =
dbe->book1DD(
"MPV_TECP2" ,
"MPV TECP2" , MPVbin, MPVmin, MPVmax);
572 MPVsTECM1 =
dbe->book1DD(
"MPV_TECM1" ,
"MPV TECM1" , MPVbin, MPVmin, MPVmax);
573 MPVsTECM2 =
dbe->book1DD(
"MPV_TECM2" ,
"MPV TECM2" , MPVbin, MPVmin, MPVmax);
575 MPVError =
dbe->book1DD(
"MPVError" ,
"MPV Error" , 150, 0, 150);
576 MPVErrorVsMPV =
dbe->book2DD(
"MPVErrorVsMPV" ,
"MPV Error vs MPV" ,300, 0, 600, 150, 0, 150);
577 MPVErrorVsEta =
dbe->book2DD(
"MPVErrorVsEta" ,
"MPV Error vs Eta" , 50, -3.0, 3.0, 150, 0, 150);
578 MPVErrorVsPhi =
dbe->book2DD(
"MPVErrorVsPhi" ,
"MPV Error vs Phi" , 50, -3.4, 3.4, 150, 0, 150);
579 MPVErrorVsN =
dbe->book2DD(
"MPVErrorVsN" ,
"MPV Error vs N" ,500, 0,1000, 150, 0, 150);
586 GainVsPrevGainTIB =
dbe->book2DD(
"GainVsPrevGainTIB" ,
"Gain vs PrevGain TIB" , 100, 0,2, 100, 0,2);
587 GainVsPrevGainTID =
dbe->book2DD(
"GainVsPrevGainTID" ,
"Gain vs PrevGain TID" , 100, 0,2, 100, 0,2);
588 GainVsPrevGainTOB =
dbe->book2DD(
"GainVsPrevGainTOB" ,
"Gain vs PrevGain TOB" , 100, 0,2, 100, 0,2);
589 GainVsPrevGainTEC =
dbe->book2DD(
"GainVsPrevGainTEC" ,
"Gain vs PrevGain TEC" , 100, 0,2, 100, 0,2);
592 for (
unsigned int i=0;
i<hnames.size();
i++){
610 const char * dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
617 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 627 tTopo_ = TopoHandle.product();
631 auto const &
Det = tkGeom->
dets();
636 unsigned int Index=0;
637 for(
unsigned int i=0;
i<
Det.size();
i++){
645 if(!DetUnit)
continue;
648 unsigned int NAPV = Topo.
nstrips()/128;
650 for(
unsigned int j=0;j<NAPV;j++){
666 APV->
x = DetUnit->position().basicVector().x();
667 APV->
y = DetUnit->position().basicVector().y();
668 APV->
z = DetUnit->position().basicVector().z();
669 APV->
Eta = DetUnit->position().basicVector().eta();
670 APV->
Phi = DetUnit->position().basicVector().phi();
671 APV->
R = DetUnit->position().basicVector().transverse();
672 APV->
Thickness = DetUnit->surface().bounds().thickness();
684 for(
unsigned int i=0;
i<
Det.size();
i++){
689 if(!DetUnit)
continue;
692 unsigned int NROCRow = Topo.
nrows()/(80.);
693 unsigned int NROCCol = Topo.
ncolumns()/(52.);
695 for(
unsigned int j=0;j<NROCRow;j++){
696 for(
unsigned int i=0;
i<NROCCol;
i++){
712 APV->
x = DetUnit->position().basicVector().x();
713 APV->
y = DetUnit->position().basicVector().y();
714 APV->
z = DetUnit->position().basicVector().z();
715 APV->
Eta = DetUnit->position().basicVector().eta();
716 APV->
Phi = DetUnit->position().basicVector().phi();
717 APV->
R = DetUnit->position().basicVector().transverse();
718 APV->
Thickness = DetUnit->surface().bounds().thickness();
752 return ( (isOn && !is0T) || (!isOn && is0T) );
770 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 799 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"WARNING: TickMarkGain in the global tag changed\n"<< std::endl
800 <<
" APV->SubDet: "<< APV->
SubDet <<
" APV->APVId:" << APV->
APVId << std::endl
801 <<
" APV->PreviousGainTick: "<<APV->
PreviousGainTick<<
" newPreviousGainTick: "<<newPreviousGainTick<<std::endl;
819 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
827 if(stag.size()!=0 && stag[0]!=
'_') stag.insert(0,1,
'_');
861 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvi.c_str()
862 <<
", statistics will not be summed!" << std::endl;
865 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Harvesting " 866 << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
875 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIB.c_str()
876 <<
", statistics will not be summed!" << std::endl;
880 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTOB.c_str()
881 <<
", statistics will not be summed!" << std::endl;
885 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDP.c_str()
886 <<
", statistics will not be summed!" << std::endl;
890 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDM.c_str()
891 <<
", statistics will not be summed!" << std::endl;
895 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP1.c_str()
896 <<
", statistics will not be summed!" << std::endl;
900 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP2.c_str()
901 <<
", statistics will not be summed!" << std::endl;
905 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM1.c_str()
906 <<
", statistics will not be summed!" << std::endl;
910 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM2.c_str()
911 <<
", statistics will not be summed!" << std::endl;
917 for (
unsigned int i=0;
i<tags.size();
i++){
920 if ( (
Charge_1[elepos][
i]).monitor==0 ) {
921 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
922 <<
", statistics will not be summed!" << std::endl;
923 }
else (
Charge_1[Harvest][i]).monitor->getTH1D()->Add((
Charge_1[elepos][i]).monitor->getTH1D());
927 for (
unsigned int i=0;
i<tags.size();
i++){
930 if ( (
Charge_2[elepos][
i]).monitor==0 ) {
931 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
932 <<
", statistics will not be summed!" << std::endl;
933 }
else (
Charge_2[Harvest][i]).monitor->getTH1D()->Add((
Charge_2[elepos][i]).monitor->getTH1D());
938 for (
unsigned int i=0;
i<tags.size();
i++){
941 if ( (
Charge_3[elepos][
i]).monitor==0 ) {
942 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
943 <<
", statistics will not be summed!" << std::endl;
944 }
else (
Charge_3[Harvest][i]).monitor->getTH1D()->Add((
Charge_3[elepos][i]).monitor->getTH1D());
949 for (
unsigned int i=0;
i<tags.size();
i++){
952 if ( (
Charge_4[elepos][
i]).monitor==0 ) {
953 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
954 <<
", statistics will not be summed!" << std::endl;
955 }
else (
Charge_4[Harvest][i]).monitor->getTH1D()->Add((
Charge_4[elepos][i]).monitor->getTH1D());
967 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
986 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1012 FitResults[0] = -0.5;
1014 FitResults[2] = -0.5;
1016 FitResults[4] = -0.5;
1022 TF1* MyLandau =
new TF1(
"MyLandau",
"landau",LowRange, HighRange);
1023 MyLandau->SetParameter(1,300);
1024 InputHisto->Fit(MyLandau,
"0QR WW");
1027 FitResults[0] = MyLandau->GetParameter(1);
1028 FitResults[1] = MyLandau->GetParError(1);
1029 FitResults[2] = MyLandau->GetParameter(2);
1030 FitResults[3] = MyLandau->GetParError(2);
1031 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1032 FitResults[5] = MyLandau->GetParameter(0);
1038 if(FitResults[0] <= 0 )
return false;
1054 NTrack+=(*trackp).size();
1058 unsigned int FirstAmplitude=0;
1059 for(
unsigned int i=0;
i<(*chargeoverpath).size();
i++){
1060 FirstAmplitude+=(*nstrips)[
i];
1061 int TI = (*trackindex)[
i];
1095 bool Saturation =
false;
1096 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1097 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1101 if(StripCharge>1024){
1104 }
else if(StripCharge>254){
1108 Charge += StripCharge;
1112 Charge = (*charge)[
i];
1114 Charge = (*charge)[
i]/265.0;
1119 double ClusterChargeOverPath = ( (double) Charge )/(*path)[
i] ;
1121 if(
Validation) {ClusterChargeOverPath/=(*gainused)[
i];}
1134 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1135 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1136 if(StripCharge>1024) StripCharge = 255;
1137 else if(StripCharge>254) StripCharge = 254;
1138 mCharge1 += StripCharge;
1139 mCharge2 += StripCharge;
1140 mCharge3 += StripCharge;
1141 mCharge4 += StripCharge;
1144 mCharge2 *= (*gainused)[
i];
1145 mCharge3 *= (*gainusedTick)[
i];
1146 mCharge4 *= ( (*gainused)[
i] * (*gainusedTick)[
i]);
1148 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1150 for(
unsigned int m=0;
m<cmon1.size();
m++) cmon1[
m]->
Fill(( (
double) mCharge1 )/(*path)[
i]);
1152 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1154 for(
unsigned int m=0;
m<cmon2.size();
m++) cmon2[
m]->
Fill(( (
double) mCharge2 )/(*path)[
i]);
1156 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1158 for(
unsigned int m=0;
m<cmon3.size();
m++) cmon3[
m]->
Fill(( (
double) mCharge3 )/(*path)[
i]);
1160 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1162 for(
unsigned int m=0;
m<cmon4.size();
m++) cmon4[
m]->
Fill(( (
double) mCharge4 )/(*path)[
i]);
1181 }
else if(APV->
Eta>0){
1193 printf(
"Openning file %3i/%3i --> %s\n",
i+1, (
int)
VInputFiles.size(), (
char*)(
VInputFiles[
i].c_str())); fflush(stdout);
1195 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1196 TTree*
tree =
dynamic_cast<TTree*
> (tfile->Get(tree_path.Data()));
1227 unsigned int nentries = tree->GetEntries();
1228 printf(
"Number of Events = %i + %i = %i\n",
NEvent,nentries,(
NEvent+nentries));
1229 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1230 printf(
"Looping on the Tree :");
1231 int TreeStep = nentries/50;
if(TreeStep<=1)TreeStep=1;
1232 for (
unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
1233 if(ientry%TreeStep==0){printf(
".");fflush(stdout);}
1234 tree->GetEntry(ientry);
1245 double FitResults[6];
1246 double MPVmean = 300;
1251 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not execute algoComputeMPVandGain method because " 1253 <<
"Please check if input contains " 1261 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1262 printf(
"Fitting Charge Distribution :");
1265 if(I%TreeStep==0){printf(
".");fflush(stdout);}
1267 if(APV->
Bin<0) APV->
Bin = chvsidx->GetXaxis()->FindBin(APV->
Index);
1271 Proj = (TH1F*)(chvsidx->ProjectionY(
"",chvsidx->GetXaxis()->FindBin(APV->
Index),chvsidx->GetXaxis()->FindBin(APV->
Index),
"e"));
1276 int SecondAPVId = APV->
APVId;
1277 if(SecondAPVId%2==0){ SecondAPVId = SecondAPVId+1; }
else{ SecondAPVId = SecondAPVId-1; }
1279 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1280 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1281 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1283 for(
unsigned int i=0;
i<16;
i++){
1288 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1289 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1290 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1298 APV->
FitMPV = FitResults[0];
1304 APV->
NEntries = Proj->GetEntries();
1326 if(APV==
NULL)
continue;
1328 unsigned int Index = APV->
Index;
1336 double FitMPV = APV->
FitMPV;
1342 if (SubDet<3)
continue;
1347 int bin = chvsidx->GetXaxis()->FindBin(Index);
1348 TH1D* Proj = chvsidx->ProjectionY(
"proj",bin,bin);
1349 for (
int binId=0; binId<Proj->GetXaxis()->GetNbins();binId++) {
1350 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1351 if (Proj->GetBinContent(binId)!=0.) {
1352 for (
unsigned int h=0;
h<charge_histos.size();
h++) {
1353 TH1D* chisto = (charge_histos[
h])->getTH1D();
1354 for (
int e=0;
e<Proj->GetBinContent(binId);
e++) chisto->Fill(new_charge);
1382 }
else if(SubDet==4) {
1389 }
else if (SubDet==5) {
1394 }
else if (SubDet==6) {
1400 if(Thickness<0.04) {
1407 if(Thickness>0.04) {
1431 unsigned int tree_Index;
1432 unsigned int tree_Bin;
1433 unsigned int tree_DetId;
1434 unsigned char tree_APVId;
1435 unsigned char tree_SubDet;
1442 float tree_Thickness;
1444 float tree_FitMPVErr;
1445 float tree_FitWidth;
1446 float tree_FitWidthErr;
1447 float tree_FitChi2NDF;
1450 double tree_PrevGain;
1451 double tree_PrevGainTick;
1452 double tree_NEntries;
1456 MyTree = tfs->
make<TTree> (
"APVGain",
"APVGain");
1457 MyTree->Branch(
"Index" ,&tree_Index ,
"Index/i");
1458 MyTree->Branch(
"Bin" ,&tree_Bin ,
"Bin/i");
1459 MyTree->Branch(
"DetId" ,&tree_DetId ,
"DetId/i");
1460 MyTree->Branch(
"APVId" ,&tree_APVId ,
"APVId/b");
1461 MyTree->Branch(
"SubDet" ,&tree_SubDet ,
"SubDet/b");
1462 MyTree->Branch(
"x" ,&tree_x ,
"x/F");
1463 MyTree->Branch(
"y" ,&tree_y ,
"y/F");
1464 MyTree->Branch(
"z" ,&tree_z ,
"z/F");
1465 MyTree->Branch(
"Eta" ,&tree_Eta ,
"Eta/F");
1466 MyTree->Branch(
"R" ,&tree_R ,
"R/F");
1467 MyTree->Branch(
"Phi" ,&tree_Phi ,
"Phi/F");
1468 MyTree->Branch(
"Thickness" ,&tree_Thickness ,
"Thickness/F");
1469 MyTree->Branch(
"FitMPV" ,&tree_FitMPV ,
"FitMPV/F");
1470 MyTree->Branch(
"FitMPVErr" ,&tree_FitMPVErr ,
"FitMPVErr/F");
1471 MyTree->Branch(
"FitWidth" ,&tree_FitWidth ,
"FitWidth/F");
1472 MyTree->Branch(
"FitWidthErr" ,&tree_FitWidthErr,
"FitWidthErr/F");
1473 MyTree->Branch(
"FitChi2NDF" ,&tree_FitChi2NDF ,
"FitChi2NDF/F");
1474 MyTree->Branch(
"FitNorm" ,&tree_FitNorm ,
"FitNorm/F");
1475 MyTree->Branch(
"Gain" ,&tree_Gain ,
"Gain/D");
1476 MyTree->Branch(
"PrevGain" ,&tree_PrevGain ,
"PrevGain/D");
1477 MyTree->Branch(
"PrevGainTick" ,&tree_PrevGainTick,
"PrevGainTick/D");
1478 MyTree->Branch(
"NEntries" ,&tree_NEntries ,
"NEntries/D");
1479 MyTree->Branch(
"isMasked" ,&tree_isMasked ,
"isMasked/O");
1482 FILE*
Gains = stdout;
1483 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1484 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1487 fprintf(Gains,
"Number of Pixel Dets = %lu\n",static_cast<unsigned long>(
NPixelDets));
1488 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1492 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1493 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1496 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1497 fprintf(Gains,
"Number of Pixel Dets = %lu\n",static_cast<unsigned long>(
NPixelDets));
1504 if(APV==
NULL)
continue;
1508 tree_Index = APV->
Index;
1510 tree_DetId = APV->
DetId;
1511 tree_APVId = APV->
APVId;
1512 tree_SubDet = APV->
SubDet;
1516 tree_Eta = APV->
Eta;
1518 tree_Phi = APV->
Phi;
1520 tree_FitMPV = APV->
FitMPV;
1524 tree_FitChi2NDF = APV->
FitChi2;
1526 tree_Gain = APV->
Gain;
1533 if(tree_DetId==402673324){
1534 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1540 if(Gains)fclose(Gains);
1551 edm::LogError(
"SiStripGainFromCalibTree") <<
"produceTagFilter -> Return false: could not retrieve the " 1553 <<
"Please check if input contains " 1563 <<
"produceTagFilter -> Return false: Statistics is too low : " << integral << endl;
1569 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD+
BAD) << endl;
1581 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1587 std::vector<float>* theSiStripVector =
NULL;
1588 unsigned int PreviousDetId = 0;
1591 if(APV==
NULL){ printf(
"Bug\n");
continue; }
1592 if(APV->
SubDet<=2)
continue;
1593 if(APV->
DetId != PreviousDetId){
1594 if(theSiStripVector!=
NULL){
1596 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1598 theSiStripVector =
new std::vector<float>;
1599 PreviousDetId = APV->
DetId;
1601 theSiStripVector->push_back(APV->
Gain);
1603 if(theSiStripVector!=
NULL){
1605 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1608 if (theSiStripVector!=
NULL)
delete theSiStripVector;
1628 TChain* t1 =
new TChain(
"SiStripCalib/APVGain");
1631 unsigned int tree_DetId;
1632 unsigned char tree_APVId;
1635 t1->SetBranchAddress(
"DetId" ,&tree_DetId );
1636 t1->SetBranchAddress(
"APVId" ,&tree_APVId );
1637 t1->SetBranchAddress(
"Gain" ,&tree_Gain );
1639 for (
unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
1640 t1->GetEntry(ientry);
MonitorElement * MPVError
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
edm::EDGetTokenT< std::vector< int > > trackindex_token_
std::vector< MonitorElement * > Charge_Vs_Index
T getParameter(std::string const &) const
EventNumber_t event() const
void swapBFieldMode(void)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< string > dqm_tag_
MonitorElement * MPVsTECP2
virtual int nrows() const =0
const std::vector< float > * trackp
unsigned int MinTrackHits
edm::EDGetTokenT< std::vector< double > > tracketa_token_
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
std::vector< APVGain::APVmon > newCharge
const std::vector< double > * chargeoverpath
MonitorElement * DiffWRTPrevGainTEC
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
const std::vector< unsigned char > * amplitude
bool isBFieldConsistentWithMode(const edm::EventSetup &iSetup) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
MonitorElement * MPV_Vs_PhiTEC
SiStripApvGain * getNewObject() override
MonitorElement * MPVsTIDP
const std::vector< double > * localdirz
size_t getNumberOfTags() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * MPVErrorVsN
const std::vector< double > * trackchi2ndof
virtual void algoBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< double > * localdirx
const std::vector< double > * gainusedTick
MonitorElement * MPV_Vs_PhiTID
~SiStripGainFromCalibTree()
dispatcher processEvent(e, inputTag, standby)
#define DEFINE_FWK_MODULE(type)
unsigned int NClusterPixel
virtual void algoEndRun(const edm::Run &run, const edm::EventSetup &iSetup) override
MonitorElement * MPV_Vs_EtaTOB
const std::vector< unsigned int > * rawid
MonitorElement * MPV_Vs_PhiTIB
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
double tagCondition_GoodFrac
SiStripGainFromCalibTree(const edm::ParameterSet &)
const TrackerTopology * tTopo_
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
MonitorElement * MPVErrorVsPhi
int subdetectorPlane(uint32_t, const TrackerTopology *)
const std::vector< int > * trackalgo
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
MonitorElement * MPV_Vs_EtaTIB
void storeOnTree(TFileService *tfs)
T * make(const Args &...args) const
make new ROOT object
const std::vector< float > * trackpt
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
const std::vector< unsigned int > * trackhitsvalid
MonitorElement * MPVsTECP
MonitorElement * MPVsTECM
void MakeCalibrationMap()
MonitorElement * MPVsTECM2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
MonitorElement * MPV_Vs_EtaTECthick
double MaxTrackChiOverNdf
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
MonitorElement * GainVsPrevGainTIB
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
bool put(const uint32_t &detID, Range input)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
std::string m_calibrationMode
T x() const
Cartesian x coordinate.
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=0)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< stAPVGain * > APVsCollOrdered
edm::EDGetTokenT< std::vector< double > > path_token_
void algoComputeMPVandGain()
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
MonitorElement * GainVsPrevGainTEC
MonitorElement * MPVErrorVsEta
edm::EDGetTokenT< std::vector< float > > trackp_token_
bool IsGoodLandauFit(double *FitResults)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, stAPVGain * > APVsColl
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool doChargeMonitorPerPlane
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
virtual void algoBeginJob(const edm::EventSetup &iSetup) override
std::pair< ContainerIterator, ContainerIterator > Range
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
const std::complex< double > I
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
const std::vector< double > * gainused
MonitorElement * MPV_Vs_EtaTID
MonitorElement * GainVsPrevGainTOB
MonitorElement * MPVsTECthick
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
edm::EDGetTokenT< std::vector< double > > localdirz_token_
static const std::string B
const std::vector< unsigned short > * firststrip
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
const std::vector< double > * localdiry
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MonitorElement * MPV_Vs_PhiTECthick
MonitorElement * GainVsPrevGainTID
MonitorElement * MPV_Vs_PhiTOB
Integral< F, X >::type integral(const F &f)
def elem(elemtype, innerHTML='', html_class='', kwargs)
MonitorElement * DiffWRTPrevGainTIB
bin
set the eta bin as selection string.
vector< string > VInputFiles
virtual void algoEndJob() override
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
std::string m_calibrationPath
const std::vector< int > * trackindex
int statCollectionFromMode(const char *tag) const
MonitorElement * MPVsTECthin
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
virtual void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< std::vector< float > > trackpt_token_
MonitorElement * DiffWRTPrevGainTOB
T const * product() const
const std::vector< bool > * overlapping
const std::vector< bool > * saturation
MonitorElement * MPVsTECP1
MonitorElement * MPV_Vs_EtaTECthin
virtual int nstrips() const =0
bool merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
int subdetectorSide(uint32_t, const TrackerTopology *)
void algoAnalyzeTheTree()
MonitorElement * MPVsTECM1
const std::vector< bool > * farfromedge
MonitorElement * MPV_Vs_PhiTECthin
MonitorElement * MPV_Vs_EtaTEC
const std::vector< bool > * TrigTech
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
virtual int ncolumns() const =0
MonitorElement * MPVErrorVsMPV
std::vector< std::string > VChargeHisto
double tagCondition_NClusters
edm::EDGetTokenT< std::vector< double > > localdirx_token_
edm::EDGetTokenT< std::vector< bool > > saturation_token_
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
edm::EDGetTokenT< std::vector< double > > localdiry_token_
const std::vector< unsigned int > * charge
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
const std::vector< double > * path
const std::vector< double > * trackphi
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
const std::vector< unsigned short > * nstrips
T const * product() const
edm::EDGetTokenT< std::vector< double > > gainused_token_
int subdetectorId(uint32_t)
MonitorElement * DiffWRTPrevGainTID
void bookDQMHistos(const char *dqm_dir, const char *tag)
edm::EDGetTokenT< std::vector< double > > trackphi_token_
const std::vector< double > * tracketa
MonitorElement * MPVsTIDM
unsigned int NClusterStrip
void merge(TH2 *A, TH2 *B)
const SiStripApvGain::Range getRange(uint32_t detID) const
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1